package com.chen.pojo;


import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.annotations.Delete;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {

    @TableId(type = IdType.AUTO)//主键自增ID
    private Long id; //主键id
    private String name; //姓名
    private Integer age;  //年龄
    private String email; //邮箱

    //加上@Version关键字，代表它是乐观锁字段
    @Version
    private Integer version; //乐观锁

    //逻辑删除字段
    @TableLogic  //逻辑删除注解
    private Integer deleted;

    //自动填充时间
    @TableField(fill = FieldFill.INSERT)
    private Date createTime; //创建时间

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime; //修改时间

}
